package com.coderknock.jedis.push;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
/**
 * 获取redis连接
 * **/
public class JedisFactory {
    private static Jedis jedis;
    static JedisPool pool;
    static {
        // 池基本配置
        JedisPoolConfig config = new JedisPoolConfig();
        config.setMaxIdle(5);
        config.setMaxWaitMillis(1000l);
        config.setTestOnBorrow(false);
        pool = new JedisPool(config,"127.0.0.1",6379, 100000,"redis213daianla2016"); //容忍的超时时间
    }
    public static Jedis getJedis() {
        return  pool.getResource();
    }
}
